<?php
/**
 * Created by PhpStorm.
 * User: Soha_Ros
 * Date: 17/6/2
 * Time: 上午1:15
 *
 * 新建商品标签
 *
 */
namespace ActionsHttp;


use Data\Food_tags;
use Data\Food_tags_DAO;

class RestaurantFoodTagsAdd extends BaseActionHttp
{
    public function doAction() {

        parent::doAction();

        // 商铺id
        $restaurant_id = $_SESSION[RESTAURANT_ID];
        $restaurant_id = 1;

        // 标签名称
        $name = $this->data[FOOD_TAG_NAME];
        // 标签颜色
        $color = $this->data[FOOD_TAG_COLOR];

        // 新建分类
        $food_tags_record = new Food_tags(array());

        $food_tags_record->setRESTAURANT_ID($restaurant_id);
        $food_tags_record->setFOOD_TAG_NAME($name);
        $food_tags_record->setFOOD_TAG_COLOR($color);

        // 插入数据库
        Food_tags_DAO::insert($food_tags_record);

        // 返回数据
        $this->ResponseDataToCurrentClient();

    }
}